<!--
 *************************************************************************
 * The contents of this file are subject to the Openbravo  Public  License
 * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
 * Version 1.1  with a permitted attribution clause; you may not  use this
 * file except in compliance with the License. You  may  obtain  a copy of
 * the License at http://www.openbravo.com/legal/license.html 
 * Software distributed under the License  is  distributed  on  an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific  language  governing  rights  and  limitations
 * under the License. 
 * The Original Code is Openbravo ERP. 
 * The Initial Developer of the Original Code is Openbravo SL 
 * All portions are Copyright (C) 2001-2006 Openbravo SL 
 * All Rights Reserved. 
 * Contributor(s):  ______________________________________.
 ************************************************************************
-->
<HTML>
<HEAD>
<TITLE>Payment selector</TITLE>
<SCRIPT language="JavaScript" type="text/javascript" id="paramDirection">var baseDirection = "../../../../../web/";</SCRIPT>
<SCRIPT language="JavaScript" src="../../../../../web/js/messages.js" type="text/javascript"></SCRIPT>
<SCRIPT language="JavaScript" type="text/javascript" id="paramLanguage">	LNG_POR_DEFECTO = "en_US";</SCRIPT>
<SCRIPT language="JavaScript" src="../../../../../web/js/utils.js" type="text/javascript"></SCRIPT>
<SCRIPT language="JavaScript" type="text/javascript">
function setMatch(valor) {
	var frm = document.frmMain;
	frm.inpMatch.value = valor;
	frm.inpMatching.value=0;
	calcDifference();
	return true;
}

function setMatching(valor, clave) {
	document.frmMain.inpMatching.value = valor;
	calcDifference();
	return true;
}

function calcDifference() {
	var frm = document.frmMain;
	var m1, m2;
	if (frm.inpMatch.value=="") m1=0
	else m1=parseFloat(frm.inpMatch.value);
	if (frm.inpMatching.value=="") m2=0
	else m2=parseFloat(frm.inpMatching.value);
	frm.inpDifference.value=m1-m2;
	if (m2==0) { //Deshabilitar el botón de process
		frm.SAVE.disabled=true;
	} else frm.SAVE.disabled=false;
	return true;
}

function process() {
	var frm = document.frmMain;
	var cuatro = parent.cuatro;
	if (cuatro && cuatro.document.frmMain) {
		cuatro.document.frmMain.inpMatchQty.value = frm.inpMatch.value;
		cuatro.submitCommandForm("PROCESS", false, null, 'MatchingPO-Receipt-Invoice_FS.html', '_parent');
	}
	return true;
}
</SCRIPT>
</HEAD>
<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<FORM name="frmMain" action="MatchingPO-Receipt-Invoice_F5.html" method="post">
  <HR></HR>
  <INPUT type="hidden" name="Command"></INPUT>
  <TABLE border="0" cellspacing="0" cellpadding="2" width="45%">
    <TR> 
      <TD  width="16%"> <SPAN >Balanced</SPAN></TD>
      <TD width="16%"> <INPUT name="inpMatch" type="text" value="0" size="10" readonly="yes"></INPUT>
      </TD>
      <TD  width="18%"> <SPAN >Balancing</SPAN></TD>
      <TD width="13%"> <INPUT name="inpMatching" type="text" value="0" size="10" readonly="yes"></INPUT>
      </TD>
      <TD  width="19%"> <SPAN >Difference</SPAN></TD>
      <TD width="12%"> <INPUT name="inpDifference" type="text" value="0" size="10" readonly="yes"></INPUT>
      </TD>
      <TD width="6%" > <INPUT type="button" value="Process" name="SAVE" onclick="process();return true;" disabled=""></INPUT>
      </TD>
    </TR>
  </TABLE>
</FORM>
</BODY>
</HTML>
